Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplication reporting update #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Deduplication reporting update #187

wants to merge 2 commits into from

Conversation

agalitsyna
Copy link
Member

Added --count-dups reporting mode for scipy and scikit-learn backends that report the number of duplicates (a little bit unfair, though, as the parent is counted there as well - it seems to make most of sense to report).

@agalitsyna agalitsyna requested a review from Phlya October 16, 2023 23:07
is_flag=True,
default=False,
help="Add column to the output pairs with the number of duplicates. "
"Comparible with sklearn and scipy backends only. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CompaTible

default=False,
help="Add column to the output pairs with the number of duplicates. "
"Comparible with sklearn and scipy backends only. "
"Is not counted by default. [output dedup pairs format option]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Off by default"?

@@ -388,6 +398,11 @@ def dedup_py(
send_header_to_dedup = send_header_to in ["both", "dedup"]
send_header_to_dup = send_header_to in ["both", "dups"]

count_dups = kwargs.get("count_dups", False)
if backend=="cython" and count_dups:
logger.warning("Not countin number of duplicates with Cython backend.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

countinG

@Phlya
Copy link
Member

Phlya commented Jan 3, 2024

Can you add tests for this feature?

Copy link
Member

@golobor golobor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@@ -221,8 +279,16 @@ def _dedup_chunk(
df = df.reset_index() # Remove the index temporarily

# Set up columns to store the dedup info:
df["clusterid"] = np.nan
df["duplicate"] = False
df.loc[:, "clusterid"] = np.nan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agalitsyna , tests fail at this line with an error message "ValueError: cannot set a frame with no defined index and a scalar".
Googling suggests that such an error arises when one tried to index an empty frame: https://stackoverflow.com/questions/48306694/valueerror-cannot-set-a-frame-with-no-defined-index-and-a-value-that-cannot-be

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe df.assign? What's your favorite way of filling in columns in dataframe?
https://stackoverflow.com/questions/34811971/how-do-i-fill-a-column-with-one-value-in-pandas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants